package org.jeecg.modules.bpm.config;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.jeecg.modules.extbpm.listener.global.GlobalEventListener;
import org.springframework.context.annotation.Configuration;

/**
 *   流程配置信息
 * @date 2019/03/06
 * @author scott
 */
@Configuration("processEngineConfig")
public class ProcessEngineConfig implements ProcessEngineConfigurationConfigurer {
    @Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
        processEngineConfiguration.setActivityFontName("宋体");
        processEngineConfiguration.setLabelFontName("宋体");
        processEngineConfiguration.setAnnotationFontName("宋体");
        
        //全局监听器
        Map<String,String> handlers=new HashMap<String, String>();
        // TASK_CREATED 任务被创建时执行
//        handlers.put(ActivitiEventType.TASK_CREATED.toString(), "taskCreatedEventListener");
        List<ActivitiEventListener> eventListeners = new ArrayList<ActivitiEventListener>();
        GlobalEventListener global = new GlobalEventListener();
        global.setHandlers(handlers);
        eventListeners.add(global);
        processEngineConfiguration.setEventListeners(eventListeners);
        
        
    }
}
